package com.zm.zmgz.utils;

/**
 * Created with IntelliJ IDEA.
 *
 * @Auther: cjw
 * @Date: 2020/04/04/15:57
 * @Description: 数字相关工具方法
 */
public class NumberUtils {

    /***
    * @Description: 获取正整数的位数
    * @Param:
    * @return:
    * @Author: cjw
    * @Date: 2020-04-04 15:59:14
    */
    public static int getDigitByInt(int number) {
        int temp = number;
        if(number < 0) {
            System.out.println("不能获取负整数的位数!");
            return -1;
        } else {
            int i = 0;
            while (number != 0) {
                number /= 10;
                i++;
            }
            System.out.println(temp+"是"+i+"位正整数!");
            return i;
        }
    }


}
